Skip to main content

Workflow API Reference

Workflows provide the orchestration layer of BindAI. A workflow coordinates multiple operations into a larger execution process. Depending on the workflow design, those operations can involve agents, tools, conditions, loops, parallel execution, retries, timeouts, human tasks, scheduling, Knowledge, Memory, and external integrations. This page describes the current Workflow API at a conceptual and architectural level while avoiding assumptions about unverified workflow classes or methods.

Overview

A workflow defines how work should be organized and executed. Conceptually:
Workflows are useful when a task requires more than a single agent execution.

Workflow Construction

BindAI supports workflow construction as a structured orchestration capability. The exact workflow construction API should be taken from the current installed implementation. The workflow documentation intentionally does not assume a specific public WorkflowBuilder class or fluent method set unless those APIs are verified. Conceptually, workflow construction involves:
  1. Defining the workflow.
  2. Defining its operations.
  3. Establishing execution order.
  4. Configuring conditions and control flow.
  5. Configuring error handling.
  6. Validating the workflow.
  7. Executing the workflow.

Workflow Components

A workflow can conceptually contain:
  • Workflow definition
  • Execution operations
  • Agents
  • Tools
  • Conditions
  • Loops
  • Parallel branches
  • Retry behavior
  • Timeout behavior
  • Human-task patterns
  • Scheduling
  • Knowledge operations
  • Memory operations
  • External integrations
  • Runtime state
Not every workflow requires all of these components.

Workflow Operations

Workflow operations represent individual units of work. An operation might:
  • Execute an agent.
  • Execute a tool.
  • Evaluate a condition.
  • Repeat work.
  • Process a collection.
  • Execute independent work in parallel.
  • Wait for human input.
  • Interact with an external system.
The exact representation of an operation depends on the workflow implementation.

Sequential Execution

The simplest workflow executes operations in sequence.
Sequential execution is appropriate when later operations depend on the results of earlier operations. For example:

Agent Execution

Agents can participate in workflows.
An agent operation can perform reasoning or generation as part of a larger process. This allows workflow orchestration to remain separate from the agent’s internal model behavior.

Tool Execution

Tools can also participate in workflow execution.
Tools are useful when a workflow needs deterministic operations, external API calls, data processing, or other operations that should not be performed solely by a language model.

Conditions

Conditions allow a workflow to choose between different execution paths. Conceptually:
Conditions are useful for business rules, validation, approvals, routing, and state-dependent execution. The exact condition API depends on the current workflow implementation.

Loops

Loops allow workflow operations to execute repeatedly.
Common use cases include:
  • Processing collections
  • Pagination
  • Repeated validation
  • Polling
  • Iterative processing
  • Batch operations
Loops should always have a well-defined termination condition or execution limit.

Parallel Execution

Independent operations can be executed in parallel when their dependencies allow it.
Parallel execution can reduce overall execution time when operations do not depend on one another. Dependent operations should remain sequential.

Workflow State

Workflow execution may require state to be passed between operations. Conceptually:
State can contain information required by later operations. Applications should distinguish temporary workflow execution state from persistent application state. Persistent information should generally use an appropriate Memory or storage provider.

Agent and Tool Results

Results from earlier operations can be used by later operations. For example:
This allows workflows to use agent output as part of subsequent orchestration decisions. The exact result-passing mechanism depends on the workflow implementation.

Workflow Context

Workflow execution may require runtime context containing information relevant to the current execution. Conceptually:
The exact context type and public API should not be assumed unless explicitly exposed by the current implementation.

Workflow Validation

Workflow definitions should be validated before production execution. Validation can identify problems such as:
  • Invalid configuration
  • Missing required operations
  • Invalid references
  • Impossible execution paths
  • Incorrect dependencies
  • Invalid control-flow configuration
Validation reduces the likelihood of discovering structural problems only after deployment. The exact validation API depends on the current workflow implementation.

Workflow Results

Workflow execution produces results representing the outcome of the workflow. Depending on the implementation, a workflow result may contain information such as:
  • Success or failure
  • Output
  • Operation results
  • Error information
  • Execution metadata
Applications should inspect the actual result type provided by the installed BindAI version. The Workflow API should not be assumed to use the same result object as Agent.run() unless explicitly implemented that way.

Error Handling

Workflow failures can originate from many components. Examples include:
  • Agent execution
  • Model providers
  • Tool execution
  • Knowledge retrieval
  • Memory providers
  • Conditions
  • External integrations
  • Workflow configuration
  • Runtime operations
Conceptually:
A workflow should define appropriate behavior for expected failure modes.

Retries

Retries can be used when an operation may fail temporarily.
Retries are particularly useful for transient failures such as some provider or network errors. They should be used carefully for operations that produce external side effects. The current BindAI retry implementation is intentionally simple and should not be interpreted as a complete distributed retry system.

Timeouts

Timeouts limit how long an operation or execution is allowed to continue. Conceptually:
Timeout behavior depends on the configured execution mechanism. A timeout should not automatically be assumed to cancel every underlying thread, task, network request, or external operation.

Human Tasks

Human-in-the-loop execution can be represented as a workflow pattern.
A human task may require an external interface, task store, authentication system, and persistence mechanism. BindAI’s workflow documentation should not assume that every workflow automatically provides a complete task-management system. The exact pause, resume, assignment, and persistence behavior depends on the current implementation.

Scheduling

Workflows can be combined with scheduling for recurring automation. Conceptually:
Scheduling is a separate concern from workflow orchestration. The scheduler, persistence model, timezone handling, and deployment behavior depend on the scheduling implementation and surrounding application infrastructure.

Knowledge Integration

Workflows can coordinate Knowledge operations. For example:
Knowledge can provide retrieved information to agents or other workflow operations. This is useful for document-processing, research, retrieval-augmented generation, and domain-specific automation.

Memory Integration

Workflows can also work alongside Memory.
Memory is appropriate for persistent or reusable application information. Temporary workflow state should not automatically be treated as persistent Memory.

External Integrations

Workflows can coordinate external services through tools and Connections.
Current Connections include integrations such as:
  • Webhooks
  • GitHub
  • Slack
  • Notion
  • Jira
  • Discord
  • Resend
  • Vercel
  • Netlify
This allows workflows to participate in larger application and automation systems.

Multi-Agent Workflows

Workflows can coordinate multiple agents.
This is useful when different stages require different agent responsibilities. Multi-agent delegation and team execution provide additional orchestration patterns beyond simple sequential agent execution.

Workflow Composition

Larger workflows can be organized into smaller logical operations. Conceptually:
Breaking complex processes into smaller units improves:
  • Testing
  • Maintainability
  • Debugging
  • Reuse
  • Observability
The exact composition mechanism depends on the current workflow API.

Workflow and Project

Projects provide a higher-level organizational concept around application components. A workflow can be part of a larger application architecture containing:
  • Agents
  • Tools
  • Knowledge
  • Memory
  • Connections
  • Other workflows
The Project API should not be assumed to provide automatic workflow registration or deployment unless those features are explicitly implemented.

Workflow and Agent

Agents and workflows have different responsibilities. A useful architecture is:
The workflow decides what happens next. The agent decides how to perform its AI task.

Workflow and Tools

Tools are usually focused on individual operations. Workflows coordinate those operations.
This separation keeps deterministic operations separate from orchestration logic.

Workflow Execution

The execution mechanism depends on the installed BindAI workflow implementation. Conceptually:
Applications should use the public execution API exposed by their installed BindAI version rather than relying on undocumented executor internals.

Serialization

Workflow persistence or transport may require serialization. However, a specific public serialization API should not be assumed unless it is implemented. This documentation therefore does not prescribe methods such as:
unless those methods are explicitly provided by the current implementation.

API Accuracy

This page intentionally avoids presenting unverified classes and methods as public API. In particular, applications should not assume the existence of:
unless those APIs are explicitly implemented by the installed BindAI version. Workflow concepts such as agents, tools, conditions, loops, parallel execution, retries, timeouts, human tasks, and scheduling describe supported orchestration capabilities; they do not necessarily correspond one-to-one with public Python classes.

Best Practices

  • Keep workflows focused on orchestration.
  • Keep agent reasoning inside agents.
  • Keep deterministic operations inside tools.
  • Keep external-service communication behind Connections where appropriate.
  • Validate workflow behavior before production use.
  • Keep conditions explicit.
  • Give loops clear termination conditions.
  • Parallelize only independent operations.
  • Use retries for appropriate transient failures.
  • Use timeouts to protect long-running operations.
  • Treat external side effects carefully.
  • Keep persistent state in appropriate storage.
  • Test failure paths as well as successful paths.

Testing

Workflow tests should cover:
  • Sequential execution
  • Conditions
  • Loops
  • Parallel execution
  • Agent operations
  • Tool operations
  • Error handling
  • Retries
  • Timeouts
  • Knowledge integration
  • Memory integration
  • External integrations
  • Multi-agent behavior
  • Human-task flows where applicable
  • Scheduling where applicable
Tests should verify both successful execution and expected failure behavior.

Related APIs

The Workflow API works closely with:
  • Agent
  • AgentResult
  • Tools
  • Knowledge
  • Memory
  • Connections
  • Multi-agent execution
  • Scheduling
  • Retry behavior
  • Timeout behavior
  • Project architecture
Together these components provide BindAI’s broader orchestration capabilities.

Summary

Workflows provide BindAI’s orchestration layer. A workflow can conceptually coordinate:
The current documentation deliberately separates workflow capabilities from assumptions about specific implementation classes. This keeps the API reference accurate while the workflow subsystem continues to evolve.